package com.osfw.system.entity.monitor;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.osfw.framework.core.entity.BasicEntity;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;

/**
 * 系统访问记录表 sys_logininfor
 */
@Data
@Accessors(chain = true)
public class SysLogininfor extends BasicEntity {
    private static final long serialVersionUID = 1L;

    /* ID */
    @TableId(value = "info_id_", type = IdType.ASSIGN_ID)
    private Long infoId;

    /* 用户账号 */
    @TableField(value = "login_name_")
    private String loginName;

    /* 登录状态 0成功 1失败 */
    @TableField(value = "status_")
    private String status;

    /* 登录IP地址 */
    @TableField(value = "ipaddr_")
    private String ipaddr;

    /* 登录地点 */
    @TableField(value = "login_location_")
    private String loginLocation;

    /* 浏览器类型 */
    @TableField(value = "browser_")
    private String browser;

    /* 操作系统 */
    @TableField(value = "os_")
    private String os;

    /* 提示消息 */
    @TableField(value = "msg_")
    private String msg;

    /* 访问时间 */
    @TableField(value = "login_time_", fill = FieldFill.INSERT)
    private Date loginTime;


    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("infoId", getInfoId())
                .append("loginName", getLoginName())
                .append("ipaddr", getIpaddr())
                .append("loginLocation", getLoginLocation())
                .append("browser", getBrowser())
                .append("os", getOs())
                .append("status", getStatus())
                .append("msg", getMsg())
                .append("loginTime", getLoginTime())
                .toString();
    }
}